Set working directory.

setwd("~/Desktop/Data Science Courses/RMarkdownPresentationandPlotly")
getwd()
## [1] "/Users/elliswm/Desktop/Data Science Courses/RMarkdownPresentationandPlotly"

Load Plotly. (Also installs ggplot2).

## install.packages("plotly")(I had to # this out in order to get the html file.)
library("plotly")
## Loading required package: ggplot2
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout

Look for database.

Using “Iris”…

Petal <- plot_ly(data = iris, x = ~Sepal.Length, y = ~Sepal.Width, color = ~Species)
Petal
## No trace type specified:
##   Based on info supplied, a 'scatter' trace seems appropriate.
##   Read more about this trace type -> https://plotly.com/r/reference/#scatter
## No scatter mode specifed:
##   Setting the mode to markers
##   Read more about this attribute -> https://plotly.com/r/reference/#scatter-mode

Set date.

Sys.Date()
## [1] "2021-09-05"